# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer:
_pkgname=openwisp-utils
pkgname="py3-$_pkgname"
pkgver=1.0.4
pkgrel=4
pkgdesc="Python and Django utilities shared between different openwisp modules"
url="https://github.com/openwisp/openwisp-utils"
arch="noarch"
license="BSD-3-Clause"
depends="
	py3-django-compress-staticfiles
	py3-django-filter
	py3-django-model-utils
	py3-django-rest-framework
	py3-drf-yasg
	py3-swapper
	python3
"
checkdepends="
	py3-openwisp-controller
"
makedepends="py3-setuptools_scm py3-gpep517"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/openwisp/openwisp-utils/archive/refs/tags/$pkgver.tar.gz"
options="!check" # circular dependency caused by testing suite (controller <=> utils)
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 runtests.py
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
3ea32fc87f789a94221154ab17893b04d59f58cc542b6315117895195c019356a8a41495a77f28c382425e246c536c78ad2e5196fd01ed3b5e4d6923879be1ab  py3-openwisp-utils-1.0.4.tar.gz
"
